package com.rz.htk.serviceprovider.controller;

import com.rz.core.kit.RespKit;
import com.rz.core.resp.ResultResp;
import com.rz.htk.serviceprovider.entity.ServiceProvider;
import com.rz.htk.serviceprovider.service.IServiceProviderService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName ServiceProviderController
 * @Description 服务商
 * @Author maweiyue
 * @Date 2019/8/16 11:37
 */
@RestController
@RequestMapping("/serviceprovider")
public class ServiceProviderController {

    @Resource
    private IServiceProviderService productService;

    @PostMapping("/getPage")
    public ResultResp getPage(@RequestBody ServiceProvider product){
        return RespKit.success(productService.getPage(product));
    }

    @PostMapping("/saveServiceProvider")
    public ResultResp saveServiceProvider(@RequestBody ServiceProvider product){
        return RespKit.success(productService.saveServiceProvider(product));
    }

    @PostMapping("/delete/{id}")
    public ResultResp delete(@PathVariable Integer id){
        return RespKit.success(productService.deleteById(id));
    }

    @PostMapping("/listByType/{type}")
    public ResultResp listByType(@PathVariable Integer type){
        return RespKit.success(productService.listByType(type));
    }
}
